﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure.StorageClient;

namespace jp110311.StorageModels
{
    [CLSCompliant(false)]
    public class UserMessagingEntity : TableServiceEntity 
    {
        public UserMessagingEntity() : base()
        {
            
        }

        public UserMessagingEntity( string sender, DateTime sendAt , string to, string title, string content )
            : base (  to, (DateTime.MaxValue.Ticks-sendAt.Ticks).ToString("D20")+sender )
        {
            Sender = sender;
            SendAt = sendAt;
            To = to;
            Title = title;
            Content = content;
        }

        public string Sender { get; set; }
        public string To { get; set; }
        public DateTime SendAt { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }

        public bool Impotance { get; set; }
        public bool Unread { get; set; }
    }

    [CLSCompliant(false)]
    public class UserMessagingIndex : TableServiceEntity
    {
        public UserMessagingIndex() :base()
        {
            
        }


        public UserMessagingIndex( string userName )
            : base ( userName, "INDEX")
        {
            
        }

        public string AllItems { get; set; }
        public string UnreadItems { get; set; }
        public string ImportanceItems { get; set; }


    }




    [CLSCompliant(false)]
    public class UserAddressBookEntity : TableServiceEntity
    {
        public UserAddressBookEntity() : base()
        {
            
        }

        public UserAddressBookEntity( string userName, string bookedUser, string memo, string tagList="") 
            : base( userName, "ADDRBOOK0"+ bookedUser )
        {
            UserName = userName;
            BookedUser = bookedUser;
            Memo = memo;
            TagList = tagList;
        }

        public string BookedUser { get; set; }

        public string UserName { get; set; }

        public string Memo { get; set; }

        public string TagList { get; set; }
    }

    [CLSCompliant(false)]
    public class UserAddressBookIndexEntity : TableServiceEntity
    {
        public UserAddressBookIndexEntity() : base()
        {
            
        }

        public UserAddressBookIndexEntity( string userName )
            : base( userName, "ADDRINDEX")
        {
        }

        public string ItemsRowKeys { get; set; }
    }

    [CLSCompliant(false)]
    public class UserAddressBookTagEntity : TableServiceEntity
    {
        public UserAddressBookTagEntity() : base()
        {
            
        }

        public UserAddressBookTagEntity( string userName, string tagName, string userList )
            : base( userName, "ADDRTAG0"+ tagName)
        {
            UserName = userName;
            TagName = tagName;
            UserList = userList;
        }

        public string UserName { get; set; }
        public string TagName { get; set; }
        public string UserList { get; set; }
    }
}
